package com.heima.article.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.article.mapper.AuthorMapper;
import com.heima.article.service.AuthorService;
import com.heima.model.article.pojos.ApAuthor;
import org.springframework.stereotype.Service;

@Service
public class AuthorServiceImpl extends ServiceImpl<AuthorMapper, ApAuthor> implements AuthorService {

    @Override
    public ApAuthor findApAuthorByUserId(Integer id) {
        LambdaQueryWrapper<ApAuthor> wrapper = Wrappers.<ApAuthor>lambdaQuery();

        wrapper.eq(ApAuthor::getWmUserId, id);

        ApAuthor author = this.getOne(wrapper);

        return author;

    }
}